package com.ethink.platform.controller.mdm;

import com.ethink.framework.common.web.BaseController;
import com.ethink.framework.common.web.response.CommonResponse;
import com.ethink.mdm.api.DictionaryFacade;
import com.ethink.mdm.api.info.CurrencyInfo;
import com.ethink.mdm.api.info.DictionaryInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author default
 * @date 2022-09-26
 */
@Tag(name = "DictionaryController", description = "字典 Controller")
@RestController
@Slf4j
@RequestMapping("platform-server/v1/mdm-service")
public class DictionaryController extends BaseController {

    @Autowired
    private DictionaryFacade dictionaryFacade;

    @Operation(summary = "查询字典枚举")
    @GetMapping("/dictionary/list")
    public CommonResponse<List<DictionaryInfo>> listDictionary(@RequestParam("group") String group) {
        return succeedWith(dictionaryFacade.listDictionaryByGroup(group));
    }

    @Operation(summary = "查询货币")
    @GetMapping("/dictionary/listAllCurrency")
    public CommonResponse<List<CurrencyInfo>> listAllCurrency() {
        return succeedWith(dictionaryFacade.listAllCurrency());
    }


}